#!/usr/bin/env bash

# 1.安装python环境
yum -y install python-pip

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  Django==1.11.3
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  django-redis==4.8.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  hiredis==0.2.0
#pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  supervisor==4.0.3  # smtp2postfix 已经安装过了
#pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  gunicorn==19.7.1
#pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  pygame==0.3
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  pygame
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  Pillow==6.0.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  xlrd==1.0.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  chardet==3.0.4
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  gunicorn==19.7.1
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  yagmail==0.14.245


## 2.安装服务 mariadb-server
#yum install mariadb-server
#systemctl start mariadb  # 开启服务
#systemctl enable mariadb  # 设置为开机自启动服务
#mysql_secure_installation  # 首次安装需要进行数据库的配置
#mysql -u root -p123456


# 3.安装服务 redis
yum -y install redis
systemctl start redis
systemctl enable redis
#redis-cli


# 4.初始化数据库
#python manage.py makemigrations core
python manage.py migrate core


# gitee 密钥
#ssh-keygen -C "trump@mail2.josephrobinettebiden.top"
#cat << EOF > /root/.ssh/id_rsa
#-----BEGIN RSA PRIVATE KEY-----
#MIIEpAIBAAKCAQEA8LbCu/TXyJ60LquWYA5Y5hnCHEGdOEiYzhY4vvpIcLRcT1QL
#rzuGU6G9OgCQY9nFikY/f3em81miBvbzBamvRu50a3UjTgkTb1DNUEqKKtfqs01G
#fCHMfFAWsRvVe7bdJw1aFfnMjKEOp/HaSnSQkrvOeUqpi96z8/VWMYidcKbQYaln
#Vk+Wl7qCVfuH7R9lFGgPHTWWdzV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